{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
<input type="hidden" name='resultre_id' id='resultre_id' value="{$info.resultre_id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row">
				<div class="col-sm-12">
				<!-- form start -->
					<div class="form-group">
						<label class="col-sm-2 control-label">分数开始：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="fraction_start" value="{$info.fraction_start}" name="fraction_start" class="form-control" placeholder="请输入分数开始">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">分数结束：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="fraction_end" value="{$info.fraction_end}" name="fraction_end" class="form-control" placeholder="请输入分数结束">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">标题：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="title" value="{$info.title}" name="title" class="form-control" placeholder="请输入标题">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">内容：</label>
						<div class="col-sm-9">
							<script id="content" type="text/plain" name="content" style="width:100%;height:300px;">{$info.content}</script>
							<script type="text/javascript">
								var ue = UE.getEditor('content',{serverUrl : '{:url("admin/Upload/uploadUeditor")}'});
								scaleEnabled:true
							</script>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">测试题id：</label>
						<div class="col-sm-9">
							<input type="text" id="topic_id" value="{$info.topic_id}" name="topic_id" class="form-control" placeholder="请输入测试题id">
						</div>
					</div>
				<!-- form end -->
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" onclick="CodeInfoDlg.edit()" id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/plugins/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['form'],function(){});
var CodeInfoDlg = {
	CodeInfoData: {},
	validateFields: {
		fraction_start: {
			validators: {
				regexp: {
					regexp: /^[0-9]*$/,
					message: ''
	 			},
	 		}
	 	},
		fraction_end: {
			validators: {
				regexp: {
					regexp: /^[0-9]*$/,
					message: ''
	 			},
	 		}
	 	},
		title: {
			validators: {
				notEmpty: {
					message: '标题不能为空'
	 			},
	 		}
	 	},
	 }
}

CodeInfoDlg.collectData = function () {
	this.set('resultre_id').set('fraction_start').set('fraction_end').set('title').set('topic_id');
};

CodeInfoDlg.edit = function () {
	 this.clearData();
	 this.collectData();
	 if (!this.validate()) {
	 	return;
	 }
	 var content = UE.getEditor('content').getContent();
	 var ajax = new $ax(Feng.ctxPath + "/Resultre.Details/edit", function (data) {
	 	if ('00' === data.status) {
	 		Feng.success(data.msg,1000);
	 		window.parent.CodeGoods.table.refresh();
	 		CodeInfoDlg.close();
	 	} else {
	 		Feng.error(data.msg + "！",1000);
		 }
	 })
	 ajax.set('content',content);
	 ajax.set(this.CodeInfoData);
	 ajax.start();
};


</script>
<script src="__PUBLIC__/static/js/base.js" charset="utf-8"></script>
{/block}
